/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gob.inamhi.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dhinojosa
 */
@Entity
@Table(name = "metr", schema="administrative")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Metr.findAll", query = "SELECT m FROM Metr m"),
    @NamedQuery(name = "Metr.findByMetrId", query = "SELECT m FROM Metr m WHERE m.metrId = :metrId"),
    @NamedQuery(name = "Metr.findByMetrIp", query = "SELECT m FROM Metr m WHERE m.metrIp = :metrIp"),
    @NamedQuery(name = "Metr.findByMetrnomb", query = "SELECT m FROM Metr m WHERE m.metrnomb = :metrnomb"),
    @NamedQuery(name = "Metr.findByMetrpath", query = "SELECT m FROM Metr m WHERE m.metrpath = :metrpath"),
    @NamedQuery(name = "Metr.findByMetrobse", query = "SELECT m FROM Metr m WHERE m.metrobse = :metrobse"),
    @NamedQuery(name = "Metr.findByMetruing", query = "SELECT m FROM Metr m WHERE m.metruing = :metruing"),
    @NamedQuery(name = "Metr.findByMetrfing", query = "SELECT m FROM Metr m WHERE m.metrfing = :metrfing"),
    @NamedQuery(name = "Metr.findByMetrumod", query = "SELECT m FROM Metr m WHERE m.metrumod = :metrumod"),
    @NamedQuery(name = "Metr.findByMetrfmod", query = "SELECT m FROM Metr m WHERE m.metrfmod = :metrfmod")})
public class Metr implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "metr__id")
    private Integer metrId;
    @Size(max = 24)
    @Column(name = "metr__ip")
    private String metrIp;
    @Size(max = 36)
    @Column(name = "metrnomb")
    private String metrnomb;
    @Size(max = 240)
    @Column(name = "metrpath")
    private String metrpath;
    @Size(max = 2147483647)
    @Column(name = "metrobse")
    private String metrobse;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "metruing")
    private String metruing;
    @Basic(optional = false)
    @NotNull
    @Column(name = "metrfing")
    @Temporal(TemporalType.TIMESTAMP)
    private Date metrfing;
    @Size(max = 20)
    @Column(name = "metrumod")
    private String metrumod;
    @Column(name = "metrfmod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date metrfmod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "metrId")
    private Collection<Tiop> tiopCollection;
    @JoinColumn(name = "sist__id", referencedColumnName = "sist__id")
    @ManyToOne(optional = false)
    private Sist sistId;
    @JoinColumn(name = "empr__id", referencedColumnName = "empr__id")
    @ManyToOne(optional = false)
    private Empr emprId;

    public Metr() {
    }

    public Metr(Integer metrId) {
        this.metrId = metrId;
    }

    public Metr(Integer metrId, String metruing, Date metrfing) {
        this.metrId = metrId;
        this.metruing = metruing;
        this.metrfing = metrfing;
    }

    public Integer getMetrId() {
        return metrId;
    }

    public void setMetrId(Integer metrId) {
        this.metrId = metrId;
    }

    public String getMetrIp() {
        return metrIp;
    }

    public void setMetrIp(String metrIp) {
        this.metrIp = metrIp;
    }

    public String getMetrnomb() {
        return metrnomb;
    }

    public void setMetrnomb(String metrnomb) {
        this.metrnomb = metrnomb;
    }

    public String getMetrpath() {
        return metrpath;
    }

    public void setMetrpath(String metrpath) {
        this.metrpath = metrpath;
    }

    public String getMetrobse() {
        return metrobse;
    }

    public void setMetrobse(String metrobse) {
        this.metrobse = metrobse;
    }

    public String getMetruing() {
        return metruing;
    }

    public void setMetruing(String metruing) {
        this.metruing = metruing;
    }

    public Date getMetrfing() {
        return metrfing;
    }

    public void setMetrfing(Date metrfing) {
        this.metrfing = metrfing;
    }

    public String getMetrumod() {
        return metrumod;
    }

    public void setMetrumod(String metrumod) {
        this.metrumod = metrumod;
    }

    public Date getMetrfmod() {
        return metrfmod;
    }

    public void setMetrfmod(Date metrfmod) {
        this.metrfmod = metrfmod;
    }

    @XmlTransient
    public Collection<Tiop> getTiopCollection() {
        return tiopCollection;
    }

    public void setTiopCollection(Collection<Tiop> tiopCollection) {
        this.tiopCollection = tiopCollection;
    }

    public Sist getSistId() {
        return sistId;
    }

    public void setSistId(Sist sistId) {
        this.sistId = sistId;
    }

    public Empr getEmprId() {
        return emprId;
    }

    public void setEmprId(Empr emprId) {
        this.emprId = emprId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (metrId != null ? metrId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Metr)) {
            return false;
        }
        Metr other = (Metr) object;
        if ((this.metrId == null && other.metrId != null) || (this.metrId != null && !this.metrId.equals(other.metrId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gob.inamhi.entidades.Metr[ metrId=" + metrId + " ]";
    }
    
}
